package com.buding.fx.utils;

import com.jfoenix.controls.JFXTreeTableView;
import com.jfoenix.svg.SVGGlyphLoader;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.Stage;


/**
 * @Author: mingdongwei
 * @Date: 2024-04-01
 * @Description:
 * @Version: 1.0.0
 */
public class TableViewUtils extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        SVGGlyphLoader.loadGlyphsFont(TableViewUtils.class.getResourceAsStream("/fonts/icomoon.svg"),
                "icomoon.svg");
        Pane panel = new Pane();
        panel.setPadding(new Insets(10,0,0,0));
        panel.setPrefWidth(500);
        panel.setPrefHeight(300);
        panel.setStyle("-fx-background-color: #f8f4f4;");
        Border border = new Border(new BorderStroke(Color.web("#A7C4EB"), BorderStrokeStyle.SOLID, new CornerRadii(0), new BorderWidths(1,1,1,1)));
        panel.setBorder(border);

        Label label = new Label("列表管理");
        VBox vBox = new VBox();
        vBox.setPadding(new Insets(5,0,0,10));
        vBox.setSpacing(5);
        vBox.getChildren().add(label);

        FlowPane flowPane = new FlowPane();
        Button addButton = new Button("增加");
        Button editButton = new Button("编辑");
        Button removeButton = new Button("删除");
        flowPane.getChildren().addAll(addButton,editButton,removeButton);
        vBox.getChildren().add(flowPane);

        JFXTreeTableView jfxTreeTableView = new JFXTreeTableView();
        vBox.getChildren().add(jfxTreeTableView);

        panel.getChildren().add(vBox);

        panel.setPadding(new Insets(10,0,0,10));
        Scene scene = new Scene(panel);

        primaryStage.setScene(scene);
        primaryStage.setTitle("文件代码转换器v0.24.04");
        primaryStage.centerOnScreen();
        primaryStage.setResizable(false);
        scene.getStylesheets().add("css/jfoenix-components.css");
        scene.getStylesheets().add("css/jfoenix-main-demo.css");
        primaryStage.show();
    }
}
